package com.bestcem.xm.ticket.controller.param.ticket.config.createParam;

import com.bestcem.xm.ticket.entity.mongo.Ticket;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import javax.annotation.Nullable;
import java.io.Serializable;

/**
 * @author zq.ding <zq.ding@idiaoyan.com>
 * @version v1.0
 * @date 2021/9/8 19:22
 */
@Data
public class SurveyAnswerParam implements Serializable {
    private static final long serialVersionUID = -7182492284143665603L;

    @JsonProperty(value = "answer")
    private String answer;

    @Nullable
    public static Ticket.TemplateDetailField.SurveyAnswer paramToEntity(SurveyAnswerParam param) {
        if (param == null) {
            return null;
        }
        Ticket.TemplateDetailField.SurveyAnswer surveyAnswer = new Ticket.TemplateDetailField.SurveyAnswer();
        surveyAnswer.setAnswer(param.getAnswer());
        return surveyAnswer;
    }
}
